<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        //最大公约数  
        var a = 319 ;
        var b = 377 ;
        var tmp ,big ,small
        if(a < b){
            big = b;
            small = a;
        }else{
            big = a;
            small = b;
        }
        while (big % small !== 0) {
            tmp = big % small;
            big = small;
            small = tmp;
        }
        console.log(small + "最大公约数");
        //最小公倍数
        var gbs = a * b / small ;
        console.log(gbs + "最小公倍数");
    </script>
</body>
</html>